package com.cgx.utils;

import com.cgx.vo.ResultVo;

/**
 * @author chenguanxin
 * @date 2021-05-25 22:55
 */
public class ResultVoUtils {


    public static ResultVo getSuccessResult() {
        return getSuccessResult("success");
    }

    public static ResultVo getSuccessResult(String message) {
        return getSuccessResult(0, message);
    }

    public static ResultVo getSuccessResult(Integer code, String message) {
        ResultVo resultVo = new ResultVo();
        resultVo.setResult(true);
        resultVo.setCode(code);
        resultVo.setMessage(message);
        return resultVo;
    }

    public static ResultVo getErrorResult() {
        return getErrorResult("error");
    }

    public static ResultVo getErrorResult(String message) {
        return getErrorResult(500, message);
    }

    public static ResultVo getErrorResult(Integer code, String message) {
        ResultVo resultVo = new ResultVo();
        resultVo.setResult(false);
        resultVo.setCode(code);
        resultVo.setMessage(message);
        return resultVo;
    }
}
